home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
COMPILER
/
SATHER
/
!Sather
/
Library
/
Graphs
/
sa
/
wtd_digr
< prev
Wrap
Text File
|
1996-07-13
|
2KB
|
38 lines
---------------------------> Sather 1.1 source file <--------------------------
-- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
-- Copyright (C) 1995, International Computer Science Institute
-- $Id: wtd_digraph.sa,v 1.1 1996/07/13 06:46:51 gomes Exp $
--
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
-- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
-- LICENSE contained in the file: Sather/Doc/License of the
-- Sather distribution. The license is also available from ICSI,
-- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
-------------------------------------------------------------------
class WTD_DIGRAPH{NTP<$STR,WTP<$NUMBER{WTP}} < $LBLD_DIGRAPH{NTP,WTP,WTP} is
-- A standard directed graph with node and edge weights of type WTP.
-- The nodes of the graph are of type NTP.
include LBLD_DIGRAPH{NTP,WTP,WTP};
bellman_ford(s:NTP, out d:MAP{NTP,WTP}, out pred:MAP{NTP,NTP}):BOOL is
-- Call into the digraph algorithm class
return WTD_DIGRAPH_ALG{NTP,WTP,SAME}::bellman_ford(self,s,out d,out pred);
end;
dijkstra(src:NTP,out dist:MAP{NTP,WTP},out pred:MAP{NTP,NTP}) is
-- Call into the digraph algorithm class
WTD_DIGRAPH_ALG{NTP,WTP,SAME}::dijkstra(self,src,out dist, out pred);
end;
max_weight_path_node!(once src,once sink: NTP): NTP is
-- Please see the comment at WTD_DIGRAPH_ALG{_,_,_,_}::max_weight_path
loop
yield WTD_DIGRAPH_ALG{NTP,WTP,SAME}::max_weight_path_node!(self,src,sink);
end;
end;
end;
-------------------------------------------------------------------